import { styleList, colorList} from "./config";
import Theme from "./Theme";
import echartsThemeController from "../Echarts/EchartsThemeController";

const initTheme = ({styleId, color}) => {
  
  echartsThemeController.initThemeList(styleList);
  styleId = styleId || styleList[0].id;
  color = color || colorList[0].color;
  const {
    defaultStyleData,
    defaultColor,
    isHide
  } = Theme.getTheme({styleId, color});
  window.less
          .modifyVars({...defaultStyleData.setting,"@primary-color": defaultColor?.color});
  echartsThemeController.setTheme(defaultStyleData.id);
};
export default initTheme;